package com.dime.basic.api.factory;



import com.dime.basic.api.RemoteItemService;
import com.dime.basic.api.domain.DimeBaseitem;
import com.ruoyi.common.core.domain.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class RemoteItemFallbackFactory implements FallbackFactory<RemoteItemService> {
    private static final Logger log = LoggerFactory.getLogger(RemoteItemFallbackFactory.class);

    @Override
    public RemoteItemService create(Throwable cause) {
        log.error("蝶美细项服务调用失败:{}", cause.getMessage());
        return new RemoteItemService() {

            @Override
            public R<DimeBaseitem> getItemById(String id) {
                return R.fail("查询细项信息:" + cause.getMessage());
            }
        };
    }
}
